<?php


namespace App\Transformers\System;


use App\Models\SystemFile;
use League\Fractal\TransformerAbstract;

class SystemFileTransformer extends TransformerAbstract
{
    public function transform(SystemFile $data)
    {
        return [
            'id' => $data->id,
            'content' => $data->content ?? '',
            'filename' => $data->filename ?? '',
            'visit_time' => $data->visit_time ? $data->visit_time->format("Y-m-d H:i:s") : '',
            'modify_time' => $data->modify_time ? $data->modify_time->format("Y-m-d H:i:s") : '',
            'change_time' => $data->change_time ? $data->change_time->format("Y-m-d H:i:s") : '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }
}
